#include "tcp_server.hpp"
#include "daemon.hpp"

using namespace std;
using namespace Alpaca;

void usage(const string &s)
{
    std::cout << "Usage:"
              << "\n\t" << s << " port" << std::endl;
}

string echo(const string &message)
{
    return message;
}

int main(int args, char *argv[])
{
    if (args != 2)
    {
        usage(argv[0]);
        exit(USAGE_ERR);
    }

    uint16_t port = atoi(argv[1]);

    TcpServer *svr = new TcpServer(echo, port);
    svr->initserver();
    
    //daemon();

    svr->start();
    return 0;
}